package org.rpgmapper.comparator;

import java.util.Comparator;

import org.rpgmapper.bo.Character;
import org.rpgmapper.bo.Stat;

public class CharacterComparator implements Comparator<Character> {

    public int compare(Character object1, Character object2) {
        if (object1 == null && object2 == null) {
            return 0;
        } else if (object1 == null) {
            return 1;
        } else if (object2 == null) {
            return -1;
        } else {
            return -(object1.get(Stat.Init) - object2.get(Stat.Init));
        }
    }
}
